package com.gene.controller.userRebateSum;

import com.gene.service.IUserRebateSumService;
import com.gene.utils.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/gene-safe/userRebateSum")
public class UserRebateSumController {

    @Autowired
    private IUserRebateSumService sumService;
   /**
     * 查询总收益
     * @return
    */
    @ResponseBody
    @RequestMapping(value = "/queryIncomeSum",method = RequestMethod.POST)
    public ResultData queryIncomeSum(@RequestParam("userId")Integer userId){
        ResultData result=new ResultData();
        double moeny=sumService.query(userId);
        if (moeny!=0){
            result.setData(moeny);
            result.setStatus("1");
            result.setMsg("查询成功！");
        }else{
            result.setStatus("0");
            result.setMsg("没有数据！");
        }
        return  result;
    }
}
